home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / security / doc / clippings / 920204-01 < prev    next >
Encoding:
Internet Message Format  |  1992-03-20  |  2.0 KB

  1. From: aem@aber.ac.uk (Alec David Muffett)
  2. Newsgroups: alt.security
  3. Subject: Re: Setuid shell scripts, Whats the problem?
  4. Message-ID: <1992Feb4.170623.5192@aber.ac.uk>
  5. Date: 4 Feb 92 17:06:23 GMT
  6. References: <1992Feb2.114728.27168@matilda.vut.edu.au> <1992Feb3.003936.9693@rz.uni-karlsruhe.de> <1992Feb03.191612.198991@cs.cmu.edu>
  7. Organization: University College of Wales, Aberystwyth
  8.  
  9. In article <1992Feb03.191612.198991@cs.cmu.edu> bsy+@cs.cmu.edu writes:
  10. >In article <1992Feb3.003936.9693@rz.uni-karlsruhe.de>, chris@rz.uni-karlsruhe.de (Christian Finger) writes:
  11. >>
  12. >>   Solution:
  13. >>   You need another binary program.
  14. >>   This program takes a pathname as parameter, expands all symbolic links etc.
  15. >>   in it (using realpath() .e.g) and exec()s the shell with the absolute
  16. >>   pathname as paramter. To use this program you have to put the
  17. >>   the pathname of it in the #! line at the beginning of your skript.
  18. >>
  19. >>Are you shure using a shell skript is easier then writing a C program ?
  20. >
  21. >Symbolic links are one way to exploit this bug.  Another is to use a
  22. >hard link when you have a writable directory in the same partition as
  23. >the setuid shell script.  Using a hard link defeats the solution
  24. >outlined above.
  25.  
  26. Actually guys, there is a simpler way to hack most setuid shell scripts...
  27.  
  28. when the kernel is told to exec a shell script names "fred"
  29. which contains the line "#!/bin/sh"
  30. it builds the line "/bin/sh fred" 
  31. goes setuid
  32. and execs that...
  33.  
  34. If you make a symlink to fred called "-i"
  35. and execute "-i"
  36. the kernel builds the line "/bin/sh -i"
  37. goes setuid
  38. and execs that...
  39.  
  40. Whammo - an interactive setuid bourne shell...
  41.  
  42.   > Don't use setuid shellscripts
  43.  
  44. Right on, brother...
  45.  
  46.             - alec
  47.  
  48. ObHack: A one line, infinitely recursive shellscript:-
  49. ------------
  50. #!/bin/sh -c
  51. ------------
  52.  
  53. -- 
  54. |+ Alec David Edward Muffett, Unix Programmer and Unemployed Coffee Drinker. +|
  55. |>  aem@aber.ac.uk aem@uk.ac.aber aem%aber@ukacrl.bitnet mcsun!ukc!aber!aem  <|
  56. | "I didn't invent the Unix Password Security problem.  I just optimised it." |
  57.  
  58.